package com.example.springbootServiceNetwork.demos.web.Controller;


import com.alibaba.fastjson.JSON;
import com.example.springbootServiceNetwork.demos.web.Config.Result;
import com.example.springbootServiceNetwork.demos.web.Dto.AliReturnPay;
import com.example.springbootServiceNetwork.demos.web.Entity.AlipayLog;
import com.example.springbootServiceNetwork.demos.web.Service.WeiXinService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@RestController
@CrossOrigin
@RequestMapping("/wx")
@ResponseBody
public class WeiXinController {

    @Resource
    private WeiXinService weiXinService;

    /**
     * 获取微信小程序手机号码
     */
    @PostMapping("/getCellPhone")
    public Result CellPhone(String code) throws IOException {
        return weiXinService.PhoneNumber(code);
    }

    /**
     * 微信扫码登陆回调地址
     */
    @PostMapping("/backLogin")
    public void backLogin(HttpServletResponse response, String param) throws IOException {
        response.setContentType("type=text/html;charset=UTF-8");
        System.out.println(param);
    }

}
